﻿using System.Collections;

namespace Tautologie
{
    static class BitArrayExtenstion
    {
        //This class provides extension methods for BitArray class.
        //If nessesary, add new method here.

        //
        //
        //

        public static BitArray Imp(this BitArray tab, BitArray value) //Performs an implication operation on the elements on current BitArray 
            //against the corresponding elements in the specified BitArray.
        {
            bool[] Result = new bool[tab.Length];
            for (int i = 0; i < tab.Length; i++)
            {
                if (tab[i] == true && value[i] == false)
                    Result[i] = false;
                else
                    Result[i] = true;
            }
            return new BitArray(Result);
        }

        public static bool IfAllElementsAreTrue(this BitArray tab) //Return a boolean value depending on wheater all elements 
            //in BitArray object are true, or not.
        {
            for (int i = 0; i < tab.Length; i++)
            {
                if (tab[i] != true)
                    return false;
            }
            return true;
        }
    }
}
